import request from "@/utils/request";

// 获取商品列表
export const getGoodsList = (params) => {
  return request({
    method: "get",
    url: "goods",
    params,
  });
};

// 删除商品
export const deleteGoods = (id) => {
  return request({
    method: "delete",
    url: `goods/${id}`,
  });
};

// 添加商品
export const addGoods = (data) => {
  return request({
    method: "post",
    url: "goods",
    data
  });
};

// 商品分类列表
export const getCateList = (data) => {
  return request({
    method: "get",
    url: "categories",
    data
  });
};

// 获取商品参数
export const getGoodsParameter = (id) => {
  return request({
    method: "get",
    url: `categories/${id}/attributes`,
    params: {
      sel:'many'
    }
  });
};

// 获取静态属性的
export const getGoodsAttribute = (id) => {
  return request({
    method: "get",
    url: `categories/${id}/attributes`,
    params: {
      sel:'only'
    }
  });
};